using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for bzUti
/// </summary>
public class bzUti
{
    public static bool isEmailAddress(object oEmail)
    {
        string pattern = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.0123456789@~";
        string theStr = oEmail.ToString();
        int index = theStr.IndexOf("@");
        for (int i = 0; i < theStr.Length; i++)
        {
            if (pattern.IndexOf(theStr[i]) == -1) return false;
        }
        if (theStr.IndexOf(" ") != -1) return false;
        if (index > 0)
        {
            int pindex = theStr.IndexOf('.');
            if ((pindex > index + 1) && (theStr.Length > pindex + 1)) return true;
        }
        return false;
    }
    public static bool isTelNo(object oTelNo)
    {

        string pattern = "0123456789-() ";
        string str = oTelNo.ToString();
        if (str.Length > 0)
        {
            if (str.Length < 5)
            {
                return false;
            }
            else
            {
                for (int a = 0; a < str.Length; a++)
                {
                    if (pattern.IndexOf(str[a]) == -1) return false;
                }
            }
        }
        return true;
    }
    public static bool isNumber(object oNumber)
    {
        string strCheck = "0123456789";
        string str = oNumber.ToString();
        for (int i = 0; i < str.Length; i++)
        {
            if (strCheck.IndexOf(str[i]) < 0) return false;
        }
        return true;
    }
   
}